<template>
  <div class="feedback">
    <!--意见反馈-->
    <div class="main">
      <el-page-header @back="$router.back(-1)" content="意见反馈"></el-page-header>
      <el-form
        v-if="type===0"
        ref="form"
        :model="form"
        label-width="80px"
        size="medium "
        style="margin-top:40px"
      >
        <el-form-item label="邮箱">
          <el-input v-model="form.fankui_user" useCustomImageHandler></el-input>
        </el-form-item>
        <el-form-item label="反馈">
          <el-input type="textarea" :rows="10" placeholder="请输入反馈的内容" v-model="form.fankui_content"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">确定</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
      <div v-else style="margin-top:50px">
        <div class="top">
          <el-button type="success" icon="el-icon-check" style="margin-right:50px" circle></el-button>
          反馈成功
        </div>
        <div class="bottom">
          <P style="text-indent:2em;">感谢您的反馈，我们会尽快做出处理，对于好的建议我们会进行采纳，并对平台做出相应的调整</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'feedback',
  data () {
    return {
      type: 0,
      form: {
        fankui_content: '',
        fankui_user: '' //  用户di
      }
    }
  },
  methods: {
    async onSubmit () {
      const result = await this.$axios.post('/webadmin/createfeedback', this.qs.stringify(this.form))
      if (result.data.state.type === 'SUCCESS') {
        this.$message.success('反馈成功')
        this.type = 1
      }
    }
  }
}
</script>

<style scoped>
  .feedback {
    width: 50%;
    min-height: 500px;
    margin: 20px auto 20px;
    border-style: solid;
    border-width: 5px;
    border-color: #90000a;
    border-radius: 25px;
    padding: 30px;
  }

  .feedback .main {
    margin: 0 auto;
    width: 80%;
  }

  .top {
    width: 200px;
    font-size: 20px;
    margin: 0 auto;
    padding: 60px;
  }

  .bottom {
    font-size: 15px;
  }
</style>
